package org.vison.wonfu.framework.soa.annotation;
import org.vison.wonfu.framework.soa.protocol.Protocol;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface SoaRef {

    /**
     *  目标服务appId
     */
    String value() default "";

    /**
     * 目标服务名称
     */
    String application() default "";

    /**
     * The ref service path
     */
    String path() default "";

    /**
     * The ref service version
     */
    String version() default "";

    /**
     * 端到端调用ip或者是域名调用
     */
    String url() default "";

    /**
     * The protocol name
     */
    Protocol protocol() default Protocol.JSON_RPC;

    /**
     * Cluster strategy
     */
    String cluster() default "";

    /**
     * group
     */
    String group() default "";

    /**
     * Load balance strategy
     */
    LoadBalance loadbalance() default LoadBalance.ROUND_ROBIN;

    /**
     * Timeout
     */
    int timeout() default 0;

    /**
     * ConnectionTimeout
     */
    int connectionTimeout() default 0;

    /**
     * Fallback class: get bean or new
     * <ol>
     *     <li>FallbackFactory class</li>
     *     <li>Fallback class</li>
     *     <li>instance</li>
     * </ol>
     */
    Class<?> fallback() default void.class;

    /**
     *  Is https
     */
    boolean https() default false;

    /**
     * The method configuration
     */
    SoaMethod[] methods() default {};
}